<?php
// +----------------------------------------------------------------------
// | 海豚PHP框架 [ DolphinPHP ]
// +----------------------------------------------------------------------
// | 版权所有 2016~2017 河源市卓锐科技有限公司 [ http://www.zrthink.com ]
// +----------------------------------------------------------------------
// | 官方网站: http://dolphinphp.com
// +----------------------------------------------------------------------
// | 开源协议 ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------

namespace app\goods\model;

use think\Model;

/**
 * 商品
 * @package app\admin\model
 */
class Product extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $table = '__GOODS_LIST__';

    // 自动写入时间戳
    protected $autoWriteTimestamp = true;


    /**
    *查询商品
    */
    public static function goodsSelect($map = [], $order = '')
    {
        $data_list = self::view('goods_list', true)
            ->view('goods_class', 'ClassName', 'goods_class.ClassID=goods_list.ClassID', 'left')
            ->view('goods_brand', 'BrandName', 'goods_brand.BrandID=goods_list.BrandID', 'left')
            ->view('goods_crowd', 'CrowdName', 'goods_crowd.CrowdID=goods_list.CrowdID','left')
            ->view('goods_unit',  'UnitName',   'goods_unit.UnitID=goods_list.UnitID','left')
            ->view('goods_colorgroup', 'GroupName ColorSizeGroupName', 'goods_colorgroup.ColorGroupID=goods_list.ColorGroupID','left')
            ->view('goods_color',  'Name ColorName',  'goods_color.ColorID=goods_list.ColorID','left')
            ->view('goods_sizegroup', 'GroupName SizeGroupName', 'goods_sizegroup.SizeGroupID=goods_list.SizeGroupID','left')
            ->view('goods_size',   'Name SizeName',   'goods_size.SizeID=goods_list.SizeID','left')
            ->where($map)
            ->order($order)
            ->paginate();
        return $data_list;
    }

    

    
}